<?php
class File extends MY_Controller
{

    protected $__enable_login_check = false;

    public function __construct()
    {
        parent::__construct();
        $this->load->library('oss');
    }

    public function uploadPic()
    {
        $file = $_FILES['img'];
        $res = $this->oss->upload_pic($file['tmp_name'], $file['name'], 'lwa/pic');
        $this->renderJson(STATUS_OK, $res);
    }

    public function uploadHeadIcon()
    {
        $file = $_FILES['file'];
        $res = $this->oss->upload_pic($file['tmp_name'], $file['name'], 'lwa/headicon');
        $this->renderJson(STATUS_OK, $res);
    }

    public function uploadCover()
    {
        $file = $_FILES['img'];
        $res = $this->oss->upload_pic($file['tmp_name'], $file['name'], 'lwa/novelcover');
        $this->renderJson(STATUS_OK, $res);
    }

    public function uploadBannerPic()
    {
        $file = $_FILES['img'];
        $res = $this->oss->upload_pic($file['tmp_name'], $file['name'], 'lwa/banner');
        $this->renderJson(STATUS_OK, $res);
    }
}